# -*- coding: utf-8 -*-
from zhi_dao import driver
import time
from selenium.webdriver.common.by import By
from zhi_dao.player import zhidao_video_player as video_player


# 章节监控，视频播放完成后自动切换下一个章节
def monitor():
    while True:
        time.sleep(10)
        playing_div = driver.find_elements(By.CSS_SELECTOR, ".vjs-playing")
        if playing_div is not None and len(playing_div) != 0:
            continue
        video_player.play_new_audio()

